#pragma once

#include "public.h"
#include <map>

namespace tinyjson
{
    class Object
    {
        using iterator = std::map<std::string, TinyJsonValuePtr>::iterator;
        using const_iterator = std::map<std::string, TinyJsonValuePtr>::const_iterator;
        friend std::ostream &operator<<(std::ostream &out, const Object &value);

    private:
        std::map<String, TinyJsonValuePtr> m_map;

    public:
        Object();
        Object(const std::map<String, TinyJsonValuePtr> &m);
        Boolean empty() const;
        size_t size() const;
        const_iterator begin() const;
        iterator begin();

        const_iterator end() const;
        iterator end();

        const_iterator find(const String &key) const;
        iterator find(const String &key);
        void insert(const std::pair<String, TinyJsonValuePtr> &key_value);
        void insert(const String &key, const TinyJsonValue &value);
        const TinyJsonValuePtr &operator[](const String &key);

    public:
        static ObjectPtr create_tinyjsonobject();
    };
}